package com.qboot.rabbitmq.topic;

import com.qboot.common.entity.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * RabbitMQ 订阅模型 Topic
 *
 * @author Tellsea
 * @date 2023/3/7
 */
@Api(tags = "RabbitMQ 订阅模型 Topic")
@RestController
@RequestMapping("/test/rabbitmq/topic")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class RabbitMqTopicController {

    private final TopicProducer workProducer;

    @ApiOperation("发送消息")
    @GetMapping("/send/{message}")
    public Result send(@PathVariable("message") String message) {
        workProducer.send(message);
        return Result.ok("发送成功");
    }
}
